package com.ddd.demo.listviewdemo;

import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;

/**
 * Created by doushuqi on 15/4/29.
 */
public class SingleFragmentActivity extends ActionBarActivity {
    public static final String FRAGMENT_PARAM = "com.ddd.demo.listviewdemo.fragment";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fragment);

        Bundle b = getIntent().getExtras();
        Class<?> fragmentClass = (Class<?>) b.get(FRAGMENT_PARAM);
        if (savedInstanceState == null) {
            Fragment fragment = Fragment.instantiate(this, fragmentClass.getName());
            fragment.setArguments(b);
            getSupportFragmentManager().beginTransaction().replace(R.id.fragment, fragment, fragmentClass.getName()).commit();
        }
    }


}
